<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Gerenciar Envolvido</title>
    </h:head>
    <h:body>
        <h:form>
            <p:commandLink value="Novo Envolvido" />
        </h:form>
        <h:form>
            <p:dataTable value="${envolvidoBean.listarEnvolvidos()}" var="envolvido" border="1" id="tabelaEnvolvidos">
                <p:column>
                    <f:facet name="header">
                        ID
                    </f:facet>
                    <h:outputText value="#{envolvido.id}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        TIPO CABELO
                    </f:facet>
                    <h:outputText value="#{envolvido.cabelo}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        ETNIA
                    </f:facet>
                    <center><h:outputText value="#{envolvido.etnia}" /></center>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        COR OLHOS
                    </f:facet>
                    <center><h:outputText value="#{envolvido.corDosOlhos}" /></center>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        ESTATURA
                    </f:facet>
                    <center><h:outputText value="#{envolvido.estatura}" /></center>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        PORTE
                    </f:facet>
                    <center><h:outputText value="#{envolvido.porte}" /></center>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        AÇÕES 
                    </f:facet>
                    <center>
                        <p:commandButton value="Excluir" update="tabelaEnvolvidos" action="#{envolvidoBean.removerEnvolvido(envolvido)}" onclick="if(!confirm('Deseja excluir o envolvido #{cabelo.tipo}')) return true;" />
                        | 
                        <p:commandButton id ="atualizarEnvolvido" value="Atualizar" action="#{envolvidoBean.carregarEnvolvido(envolvido)}" />
                    </center>
                </p:column>
            </p:dataTable>
            <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">  
                <h:outputText value="Cor do cabelo: " />  
                <p:selectOneRadio id="cabelo" value="#{envolvidoBean.envolvido.cabelo}">  
                    <f:selectItem itemLabel="Loiro" itemValue="Loiro" />  
                    <f:selectItem itemLabel="Preto" itemValue="Preto" />  
                    <f:selectItem itemLabel="Castanho" itemValue="Castanho" />
                    <f:selectItem itemLabel="Crespo" itemValue="Crespo" />
                    <f:selectItem itemLabel="Ruivo" itemValue="Ruivo" />
                    <f:selectItem itemLabel="Grisalho" itemValue="Grisalho" />
                    <f:selectItem itemLabel="Calvo" itemValue="Calvo" />
                </p:selectOneRadio>  
            </h:panelGrid>
            <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">  
                <h:outputText value="Cor do cabelo: " />  
                <p:selectOneRadio id="etnia" value="#{envolvidoBean.envolvido.etnia}">  
                    <f:selectItem itemLabel="Branco" itemValue="Branco" />  
                    <f:selectItem itemLabel="Negro" itemValue="Negro" />  
                </p:selectOneRadio>  
            </h:panelGrid>
            <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">  
                <h:outputText value="Cor do cabelo: " />  
                <p:selectOneRadio id="cordosolhos" value="#{envolvidoBean.envolvido.corDosOlhos}">  
                    <f:selectItem itemLabel="Castanho-Escuros" itemValue="Castanho-Escuros" />
                    <f:selectItem itemLabel="Castanho-Claros" itemValue="Castanho-Claros" />
                    <f:selectItem itemLabel="Azuis" itemValue="Azuis" />  
                    <f:selectItem itemLabel="Verdes" itemValue="Verdes" />
                    <f:selectItem itemLabel="Negros" itemValue="Negros" />
                </p:selectOneRadio>  
            </h:panelGrid>
            <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">  
                <h:outputText value="Cor do cabelo: " />  
                <p:selectOneRadio id="estatura" value="#{envolvidoBean.envolvido.estatura}">  
                    <f:selectItem itemLabel="Alta" itemValue="Alta" />  
                    <f:selectItem itemLabel="Baixa" itemValue="Baixa" />  
                    <f:selectItem itemLabel="Mediana" itemValue="Mediana" />
                </p:selectOneRadio>  
            </h:panelGrid>
            <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">  
                <h:outputText value="Cor do cabelo: " />  
                <p:selectOneRadio id="porte" value="#{envolvidoBean.envolvido.porte}">  
                    <f:selectItem itemLabel="Normal" itemValue="Normal" />  
                    <f:selectItem itemLabel="Magro" itemValue="Magro" />  
                    <f:selectItem itemLabel="Gordo" itemValue="Gordo" />
                    <f:selectItem itemLabel="Forte" itemValue="Forte" />
                </p:selectOneRadio>  
            </h:panelGrid>
            <h:panelGrid columns="2" id="display">  
                <h:outputText value="Cabelo:" />  
                <h:outputText id="value1" value="#{envolvidoBean.envolvido.cabelo}" />  
                <h:outputText value="Etnia:" />  
                <h:outputText id="value2" value="#{envolvidoBean.envolvido.etnia}" />  
                <h:outputText value="Cor dos Olhos:" />  
                <h:outputText id="value3" value="#{envolvidoBean.envolvido.corDosOlhos}"/>
                <h:outputText value="Estatura:" />  
                <h:outputText id="value4" value="#{envolvidoBean.envolvido.estatura}"/> 
                <h:outputText value="Porte:" />  
                <h:outputText id="value5" value="#{envolvidoBean.envolvido.porte}"/> 
            </h:panelGrid>
            <h:panelGrid columns="2">
                <h:outputText value="Detalhes da descricão do envolvido:" />
                <h:inputText value="#{envolvidoBean.envolvido.descricao}" />
            </h:panelGrid>
            <p:commandButton id="submitButton" value="Adicionar Envolvido" update="tabelaEnvolvidos" action="#{envolvidoBean.adicionarEnvolvido}"/>
            <p:commandButton value="Limpar Campos" type="reset" />
        </h:form>
    </h:body>
</html>